package com.sirius.meta.mall.product.logic.controller;


import com.sirius.common.utils.model.ApiResult;
import com.sirius.common.utils.model.TestVo;
import com.sirius.meta.mall.product.logic.bean.PmsCategory;
import com.sirius.meta.mall.product.logic.handler.PmsCategoryHandler;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 * 商品三级分类 前端控制器
 * </p>
 *
 * @author fanxioadiu
 * @since 2021-11-13
 */
@Api()
@RequestMapping("/pmsCategory")
public class PmsCategoryController {

    private final PmsCategoryHandler pmsCategoryHandler;

    public PmsCategoryController(PmsCategoryHandler pmsCategoryHandler) {
        this.pmsCategoryHandler = pmsCategoryHandler;
    }

    @ApiOperation("查询所有分类")
    @ApiImplicitParams(value = {@ApiImplicitParam(name = "username", dataTypeClass = List.class, value = "分类集合")})
    @GetMapping("/list")
    public ApiResult<List<PmsCategory>> getPmsCategoryList() {
        List<PmsCategory> pmsCategoryList = pmsCategoryHandler.getPmsCategoryList();
        return ApiResult.ok(pmsCategoryList);
    }
}
